﻿<Canvas x:Class="LFSRecord2.View.KeylaneView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:lfsconv="clr-namespace:LFSRecord2.View.Converters"
             xmlns:lfsvstruct="clr-namespace:LFSRecord2.View.TimelineStructures"
             mc:Ignorable="d" 
             d:DesignHeight="18" d:DesignWidth="350" 
             Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ItemsControl}}, Path=Width}" 
             Height="18" SnapsToDevicePixels="True" Background="Transparent"
             MouseLeftButtonDown="KeyLane_LeftButtonMouseDown">
    <Canvas.Resources>
        <lfsconv:FrameToLeftMarginConverter x:Key="frameToLeftMarginConverter" />
    </Canvas.Resources>
    <Line X1="0" X2="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=ActualWidth}"
            Y1="17.5" Y2="17.5"
            Stroke="#FF808080"
            StrokeThickness="1"
            IsHitTestVisible="False" />
    <Canvas Name="KeyCanvas" Background="Transparent">
        <ItemsControl ItemsSource="{Binding KeyFrames}" Focusable="False" HorizontalAlignment="Left" VerticalAlignment="Top">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Canvas />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>

            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <lfsvstruct:KeyImageControl
                            DataContext="{Binding}"
                            MouseLeftButtonDown="KeyImage_MouseLeftButtonDown"
                            Margin="{Binding FrameNum, Converter={StaticResource frameToLeftMarginConverter}}" />
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Canvas>
</Canvas>
